﻿using UnityEngine;
using System.Collections;

public class TriggerArea : MonoBehaviour {

	public Transform target;
	public string searchForTag = "";

	void OnTriggerEnter(Collider coll)
	{
		if (target==null && coll.gameObject.tag.Equals (searchForTag))
		{
			target = coll.transform;
		}
	}

	void OnTriggerStay(Collider coll)
	{
		if (target==null && coll.gameObject.tag.Equals (searchForTag))
		{
			target = coll.transform;
		}
	}

	void OnTriggerExit(Collider coll)
	{
		if (coll.transform.Equals(target))
		{
			target = null;
		}
	}
}
